<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class MY_Controller extends CI_Controller {

        function __construct()
        {
            parent::__construct();
            header("Content-Type:text/html;charset=utf-8");  //设置系统的输出字符为utf-8
            date_default_timezone_set("PRC");             //设置时区（中国）
        }


    }

    class Admin_Controller extends MY_Controller
    {
        function __construct()
        {
            parent::__construct();
            $this->_check_login();
        }

        //验证是否登录
        function _check_login()
        {
            if(! $this->session->userdata('uid'))
            {   
                redirect('/admin/login');

            }
            else
            {
                $this->_admin=$this->db->from('crazy_admin')->where('id',$this->session->userdata('uid'))->get()->row();
            }

        } 
		
		
		
		//检查是否拥有超级管理员权限
		function _check_admin()
		{
			if($this->_admin->usertype<10)
			{
				echo '权限不足';
				exit;
			}
		}
		
		

    }


